#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include "personwidget.h"
#include "picturewidget.h"
#include "updateinformation.h"
#include "person.h"
#include "facechange.h"
#include "interestchange.h"
#include "transferchange.h"
#include "distinguishchange.h"
#include "personal_space.h"
#include "waitwidget.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWidget; }
QT_END_NAMESPACE

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    MainWidget(QWidget *parent = nullptr, Person * l_user = nullptr);
    ~MainWidget();
    void basicSettings(); //基础设置
    void connectSettings(); //连接设置
    void updateMenu(); //刷新界面数据
    QPixmap PixmapToRound(const QPixmap &src, int radius); //圆形头像

    friend class personWidget; //个人菜单为友元类

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;

private:
    Ui::MainWidget *ui;

    Person * user = nullptr; //用户指针
    QPoint address; //鼠标位置
    personWidget * personCombo = nullptr;  //个人菜单下拉框
    waitWidget * wait = new waitWidget(); //等待窗口
    updateInformation * updateInfo = new updateInformation(this, user); //个人信息修改
    faceChange * faceChan = new faceChange(this, user); //实时换脸页面
    interestChange * interestChan = new interestChange(this, user); //趣味换脸页面
    transferChange * transferChan = new transferChange(this, user); //风格迁移页面
    distinguishChange * distingChan = new distinguishChange(this, user); //人脸识别页面

    Personal_Space * personalSpace = new Personal_Space(nullptr, user); //个人中心页面

signals:
    void backLogin();

public slots:
    void btnPersonalText_clicked(); //个人菜单
    void updateUser(Person *user); //更新用户信息（目前非数据库）
    void restoreDefaultView(); //恢复初始界面
    void showWait(); //打开等待窗口
    void closeWait(); //关闭等待窗口

    void remakePersonalSpace(); //重启个人中心
};
#endif // MAINWIDGET_H
